#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n3_addiu_test)
    .set noreorder
    addiu s0, s0 ,1
    li  s2, 0x0
###test inst
    TEST_ADDIU(0xfb263d10, 0x0000ec96, 0xfb2629a6)
    TEST_ADDIU(0x7ec10538, 0x00000996, 0x7ec10ece)
    TEST_ADDIU(0x0e505a00, 0x0000b718, 0x0e501118)
    TEST_ADDIU(0xa522b9d7, 0x0000c784, 0xa522815b)
    TEST_ADDIU(0x9b45d7c0, 0x0000b6d2, 0x9b458e92)
    TEST_ADDIU(0xa4c655b8, 0x0000ac62, 0xa4c6021a)
    TEST_ADDIU(0xa52b697a, 0x0000b159, 0xa52b1ad3)
    TEST_ADDIU(0xdcc82666, 0x0000675b, 0xdcc88dc1)
    TEST_ADDIU(0xab24a3c3, 0x00000b0f, 0xab24aed2)
    TEST_ADDIU(0xdb650604, 0x0000a9ef, 0xdb64aff3)
    TEST_ADDIU(0x7a305380, 0x0000f974, 0x7a304cf4)
    TEST_ADDIU(0x6bafed18, 0x0000d39e, 0x6bafc0b6)
    TEST_ADDIU(0x76de1bd0, 0x0000025d, 0x76de1e2d)
    TEST_ADDIU(0xc330d268, 0x00006912, 0xc3313b7a)
    TEST_ADDIU(0x2d2701f1, 0x000040ef, 0x2d2742e0)
    TEST_ADDIU(0x5454990a, 0x00003779, 0x5454d083)
    TEST_ADDIU(0x21b8cf00, 0x0000a8f8, 0x21b877f8)
    TEST_ADDIU(0x44e31f12, 0x0000b380, 0x44e2d292)
    TEST_ADDIU(0x40f8f8f8, 0x0000b7b0, 0x40f8b0a8)
    TEST_ADDIU(0xd50073d0, 0x000062f7, 0xd500d6c7)
    TEST_ADDIU(0x5226e1b0, 0x0000c51c, 0x5226a6cc)
    TEST_ADDIU(0x25148680, 0x0000fd40, 0x251483c0)
    TEST_ADDIU(0xafd55a35, 0x0000ae3c, 0xafd50871)
    TEST_ADDIU(0xfab9b6bf, 0x000025cc, 0xfab9dc8b)
    TEST_ADDIU(0xab40e400, 0x000033b8, 0xab4117b8)
    TEST_ADDIU(0x3ee87380, 0x0000e8a6, 0x3ee85c26)
    TEST_ADDIU(0x2b0bf1ba, 0x00002cf0, 0x2b0c1eaa)
    TEST_ADDIU(0x02b5b620, 0x0000c64b, 0x02b57c6b)
    TEST_ADDIU(0xe61df57a, 0x00007068, 0xe61e65e2)
    TEST_ADDIU(0x992f982c, 0x0000a1c8, 0x992f39f4)
    TEST_ADDIU(0x193ae478, 0x0000a733, 0x193a8bab)
    TEST_ADDIU(0xb7554a70, 0x0000263a, 0xb75570aa)
    TEST_ADDIU(0xe6644fa0, 0x00006f78, 0xe664bf18)
    TEST_ADDIU(0xdeff13d4, 0x00003dc7, 0xdeff519b)
    TEST_ADDIU(0x5c07037c, 0x00003e56, 0x5c0741d2)
    TEST_ADDIU(0xc06c54f0, 0x0000c2b0, 0xc06c17a0)
    TEST_ADDIU(0xf5f6a31c, 0x00000700, 0xf5f6aa1c)
    TEST_ADDIU(0x8da08d64, 0x00007304, 0x8da10068)
    TEST_ADDIU(0x2f398330, 0x00002680, 0x2f39a9b0)
    TEST_ADDIU(0x16b44d6e, 0x00008d58, 0x16b3dac6)
    TEST_ADDIU(0xa79f87b2, 0x0000d18f, 0xa79f5941)
    TEST_ADDIU(0x52a8369a, 0x000076a0, 0x52a8ad3a)
    TEST_ADDIU(0x18c0f00e, 0x0000bf8e, 0x18c0af9c)
    TEST_ADDIU(0x33fbb9c0, 0x0000b965, 0x33fb7325)
    TEST_ADDIU(0x70c8b0f7, 0x0000be62, 0x70c86f59)
    TEST_ADDIU(0x3f0194b4, 0x00007ed4, 0x3f021388)
    TEST_ADDIU(0xc5c166c0, 0x00007616, 0xc5c1dcd6)
    TEST_ADDIU(0x9edd7138, 0x000029c0, 0x9edd9af8)
    TEST_ADDIU(0xa608d4a8, 0x0000871b, 0xa6085bc3)
    TEST_ADDIU(0x0e35d674, 0x000004d6, 0x0e35db4a)
    TEST_ADDIU(0x0b3a17e8, 0x0000d3f8, 0x0b39ebe0)
    TEST_ADDIU(0xfc4b4e00, 0x0000bd0a, 0xfc4b0b0a)
    TEST_ADDIU(0xcd350818, 0x0000b7e4, 0xcd34bffc)
    TEST_ADDIU(0x67296578, 0x00006330, 0x6729c8a8)
    TEST_ADDIU(0xe5b1f42a, 0x00001b64, 0xe5b20f8e)
    TEST_ADDIU(0xd814f8b8, 0x00002f5a, 0xd8152812)
    TEST_ADDIU(0xb0f445a2, 0x00003818, 0xb0f47dba)
    TEST_ADDIU(0x97644268, 0x00006808, 0x9764aa70)
    TEST_ADDIU(0x2ce484d1, 0x0000b29a, 0x2ce4376b)
    TEST_ADDIU(0x8a3beb89, 0x0000bee0, 0x8a3baa69)
    TEST_ADDIU(0x3e64a422, 0x0000f7fa, 0x3e649c1c)
    TEST_ADDIU(0x363f5f5a, 0x00006ea4, 0x363fcdfe)
    TEST_ADDIU(0x9b14a354, 0x000020c0, 0x9b14c414)
    TEST_ADDIU(0x22733f48, 0x0000f49e, 0x227333e6)
    TEST_ADDIU(0x018b8160, 0x0000e23e, 0x018b639e)
    TEST_ADDIU(0x584e80ae, 0x0000fbff, 0x584e7cad)
    TEST_ADDIU(0x9fe30c58, 0x0000863c, 0x9fe29294)
    TEST_ADDIU(0x045aa874, 0x00008418, 0x045a2c8c)
    TEST_ADDIU(0xf890cfc0, 0x0000e16c, 0xf890b12c)
    TEST_ADDIU(0xaebdc18e, 0x0000a790, 0xaebd691e)
    TEST_ADDIU(0xd04949c0, 0x00001af8, 0xd04964b8)
    TEST_ADDIU(0x74943d80, 0x000049fc, 0x7494877c)
    TEST_ADDIU(0x383ecfd8, 0x0000d9f8, 0x383ea9d0)
    TEST_ADDIU(0x3d2dae08, 0x00007bbe, 0x3d2e29c6)
    TEST_ADDIU(0xf3992fc0, 0x000070e8, 0xf399a0a8)
    TEST_ADDIU(0xa7749c20, 0x0000df30, 0xa7747b50)
    TEST_ADDIU(0x92556ce8, 0x000046d8, 0x9255b3c0)
    TEST_ADDIU(0xaa139e00, 0x0000a98a, 0xaa13478a)
    TEST_ADDIU(0xd0a2ede0, 0x00004b2e, 0xd0a3390e)
    TEST_ADDIU(0xc1ace9cc, 0x0000473b, 0xc1ad3107)
    TEST_ADDIU(0xdbd9f2a0, 0x00002380, 0xdbda1620)
    TEST_ADDIU(0x0f650db8, 0x00003b92, 0x0f65494a)
    TEST_ADDIU(0x550f1e96, 0x0000bb74, 0x550eda0a)
    TEST_ADDIU(0xd1ce32b8, 0x00009b80, 0xd1cdce38)
    TEST_ADDIU(0x3afc2d2a, 0x00005d5b, 0x3afc8a85)
    TEST_ADDIU(0x1fe5c9fc, 0x000001f4, 0x1fe5cbf0)
    TEST_ADDIU(0xc3ce865a, 0x0000bb9f, 0xc3ce41f9)
    TEST_ADDIU(0x78a0a5c0, 0x0000af78, 0x78a05538)
    TEST_ADDIU(0x70359bfe, 0x000006fa, 0x7035a2f8)
    TEST_ADDIU(0x4320a31e, 0x000083cc, 0x432026ea)
    TEST_ADDIU(0x59dfac54, 0x00007d1c, 0x59e02970)
    TEST_ADDIU(0x45d87ca0, 0x0000d980, 0x45d85620)
    TEST_ADDIU(0x049ec678, 0x000088b6, 0x049e4f2e)
    TEST_ADDIU(0x0c88f0c8, 0x00002a72, 0x0c891b3a)
    TEST_ADDIU(0x8a250cd0, 0x0000b540, 0x8a24c210)
    TEST_ADDIU(0xae8225b3, 0x0000c62c, 0xae81ebdf)
    TEST_ADDIU(0xd8a748bc, 0x0000d6f9, 0xd8a71fb5)
    TEST_ADDIU(0x75f0666e, 0x000026c8, 0x75f08d36)
    TEST_ADDIU(0x257cf136, 0x0000d049, 0x257cc17f)
    TEST_ADDIU(0xc040fc10, 0x00007d28, 0xc0417938)
    TEST_ADDIU(0x5ac0c900, 0x0000775d, 0x5ac1405d)
    TEST_ADDIU(0xaa1e08d6, 0x0000228d, 0xaa1e2b63)
    TEST_ADDIU(0xdca90938, 0x00006c98, 0xdca975d0)
    TEST_ADDIU(0x57945512, 0x0000eda8, 0x579442ba)
    TEST_ADDIU(0xd5c7d9c0, 0x0000a5bf, 0xd5c77f7f)
    TEST_ADDIU(0xe2287446, 0x00003264, 0xe228a6aa)
    TEST_ADDIU(0xef90df60, 0x0000722b, 0xef91518b)
    TEST_ADDIU(0x750b7770, 0x00000000, 0x750b7770)
    TEST_ADDIU(0x86ffd3dc, 0x00000000, 0x86ffd3dc)
    TEST_ADDIU(0xc6479348, 0x00000000, 0xc6479348)
    TEST_ADDIU(0xfeb9209d, 0x00000000, 0xfeb9209d)
    TEST_ADDIU(0xf8caf9a4, 0x00000000, 0xf8caf9a4)
    TEST_ADDIU(0xef30ffee, 0x00000000, 0xef30ffee)
    TEST_ADDIU(0x850e19af, 0x00000000, 0x850e19af)
    TEST_ADDIU(0xfa5cb710, 0x00000000, 0xfa5cb710)
    TEST_ADDIU(0x394e5640, 0x00000000, 0x394e5640)
    TEST_ADDIU(0x49ceac94, 0x00000000, 0x49ceac94)
    TEST_ADDIU(0x23ae136b, 0x00000000, 0x23ae136b)
    TEST_ADDIU(0xf650e782, 0x00000000, 0xf650e782)
    TEST_ADDIU(0x00000000, 0x000004a0, 0x000004a0)
    TEST_ADDIU(0x00000000, 0x0000d6d9, 0xffffd6d9)
    TEST_ADDIU(0x00000000, 0x0000cdc8, 0xffffcdc8)
    TEST_ADDIU(0x00000000, 0x00000000, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n3_addiu_test)
